/**
 *
 */
package de.sendorian.app.forumArchive.download;

import java.util.List;
import java.util.Set;

import javax.annotation.Nonnull;

import de.sendorian.app.forumArchive.domain.File;
import de.sendorian.app.forumArchive.domain.Image;
import de.sendorian.app.forumArchive.domain.Topic;
import de.sendorian.util.CollectionUtils;


public class ImageDownloadTask extends DownloadTaskBase implements DownloadTask, Runnable {

    ImageDownloadTask(@Nonnull Image image, @Nonnull final Topic topic, @Nonnull Set<String> downloadedFiles,
            @Nonnull List<String> filesInArchives) {
        super(image, topic, downloadedFiles, filesInArchives);
    }


    public void run() {
        downloadFile();
    }
    
    /*
     * (non-Javadoc)
     * 
     * @see de.sendorian.app.forumArchive.download.DownloadTask#downloadFile()
     */
    public boolean downloadFile() {
        File image = file;
        if (!CollectionUtils.containsIgnoreCase(image.getName(), filesInArchives)) {
            return super.downloadFile();
        }
        return false;
    }
}
